盒子
盒子

Use windbg to check memory leak

From:
http://blogs.msdn.com/b/paullou/archive/2011/06/28/debugging-managed-code-memory-leak-with-memory-dump-using-windbg.aspx

1
2
#Set symbols File >> Symbol File path
SRV*c:\symbols*http://msdl.microsoft.com/download/symbols
1
.reload
1
.loadby sos clr or .loadby sos mscorwks!
1
2
#optional
!VerifyHeap
1
2
#Find largest GC Heapsize - leak is possible if > 1gb or so
!EEHeap
1
2
#Find type with the largest size
!dumpheap -stat
1
2
#put type here - find type with the largest size
!dumpheap -type [TYPE]
1
2
#put largest result here
!do [ADDRESS]

Loop above as needed, this is where it gets a bit fuzzy. Look for repeating patterns and high threads

1
2
#get a count of thread on the thing. Find a high thread count
!threads
1
2
#Pick a thread to look at it's stack - alternatively you can rum ~*kb for all thread stacks
~[THREAD ID]s
1
2
#show the stack
Kb

呼呼呼山
2020-04-10 11:50:34